<%@ page language="java" import="java.util.*" contentType="text/html"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta charset="UTF-8" />
<title>用户列表</title>
<link rel="stylesheet" type="text/css"
	href='<c:url value="/share/styles.css"></c:url>' />
<script src='<c:url value="/js/boot.js"></c:url>'></script>
<script src='<c:url value="/js/rqfui/rqfui.js"></c:url>'></script>
<style type="text/css">
body, html {
	width: 100%;
	height: 100%;
	margin: 0;
	font-family: "微软雅黑";
}
</style>
</head>
<body>
	<div class="mini-toolbar"
		style="padding: 0px; border-width: 1px; border-bottom-width: 0px;">
		<table style="width: 100%;">
			<tr height="23px">
				<td width="20px"></td>
				<td width="100px"><a class="mini-button" id="resetBtn"
					iconCls="icon-reset" plain="true" onclick="reloadList">刷新</a></td>
				<td width="100px"><a class="mini-button" id="okBtn"
					iconCls="icon-ok" plain="true" onclick="confirm()">确定</a></td>
				<td width="300px"></td>
			</tr>
		</table>
	</div>
	<div class="mini-fit">
		<div id="datagrid1" class="mini-datagrid gridFull"
			borderStyle="border:1;" showReloadButton="true" pagesize="20"
			sizeList="[20,50,100,200]" allowCellWrap="true"
			allowHeaderWrap="true" idField="No" multiSelect="true"
			showPager="true" allowAlternating="true"
			onrowdblclick="gridRowDbClick"
			style="height: 100%; width: 100%; -moz-user-select: none; -webkit-user-select: none;"
			collapseGroupOnLoad="false" showColumnsMenu="true"
			showFilterRow="true" onshowrowdetail="onShowRowDetail">
			<div property="columns">
				<div type="checkcolumn" width="40px"></div>
				<div field="Action" width="70px" headerAlign="center" align="center">
					<a class="mini-button" property="filter" id="removeBtn"
						iconCls="icon-broom" tooltip="清除筛选" onclick="removeSearch">清除
					</a>
				</div>
				<div field="nickname" width="150px" headerAlign="center"
					align="left" allowSort="true">
					账号<input id="filter1" property="filter"
						class="mini-buttonedit searchbox" style="width: 100%;"
						onValueChanged="onselect" emptyText="筛选..." onenter="onselect" />
				</div>
				<div field="name" width="150px" headerAlign="center" align="left"
					allowSort="true">
					姓名<input id="filter2" property="filter"
						class="mini-buttonedit searchbox" style="width: 100%;"
						onbuttonclick="onselect" emptyText="筛选..." onenter="onselect" />
				</div>
				<div name="emptyCol" width='100%' headerAlign="center"
					align="center" cellStyle="padding:0;"></div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		mini.parse();
		mini_debugger = false;
		var rootPath = '${rootPath}';
		var filterHelper = gridFilter();
		var datagrid1 = mini.get("datagrid1");
		var filter1 = mini.get("filter1");
		var filter2 = mini.get("filter2");
		$(function() {
			loadGrid1();
		});
		//双击
		function onselect() {
			var filterValue1 = filter1.getValue();
			var filterValue2 = filter2.getValue();
			if (filterValue1 != "") {
				var filterdata = filterHelper.formFilterData("nickname",
						filterValue1, '', 'CONTAIN', 'AND');
				filterHelper.addFilterData(filterdata);
			}
			if (filterValue2 != "") {
				var filterdata = filterHelper.formFilterData("name",
						filterValue2, '', 'CONTAIN', 'AND');
				filterHelper.addFilterData(filterdata);
			}
			loadGrid1();
		}
		function loadGrid1() {
			var filterData = filterHelper.getFilterData();
			var postData = new Object();
			if (filterData != null || filterData.length > 0) {
				postData.filterdata = mini.encode(filterData);
			}
			var url = "<c:url value='/surveyPaper/userlist' />";
			datagrid1.load(url);
			datagrid1.load(postData);
		}
		function removeSearch() {
			filter1.setValue();
			filter1.setText();
			filter2.setValue();
			filter2.setText();
			filterHelper.clearFilterData();
			loadGrid1();

		}
		function reloadList() {
			datagrid1.reload();
		}

		function confirm() {
			var ids = datagrid1.getSelecteds();
			if (ids.length < 1) {
				mini.alert("请选择至少一道试题！");
			} else {
				var str = "";
				for (var i = 0; i < ids.length; i++) {
					if (i == 0) {
						str = ids[0].id;
					} else {
						str += "," + ids[i].id;
					}
				}
				CloseWindow(str.toString());
			}
		}
		function CloseWindow(action) {
			if (window.CloseOwnerWindow) {
				return window.CloseOwnerWindow(action);
			} else {
				window.close();
			}
		}
	</script>
</body>
</html>